/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bs.Beans;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Bone
 */
@Entity
@Table(name = "tabela_preco")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TabelaPreco.findAll", query = "SELECT t FROM TabelaPreco t")})
public class TabelaPreco implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(nullable = false)
    private Integer id;
    @Column(length = 100)
    private String nome;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(precision = 18, scale = 6)
    private BigDecimal coeficiente;
    private Character principal;
    @Column(name = "BASE_CUSTO")
    private Character baseCusto;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idTabelaPreco")
    private List<TabelaPrecoProduto> tabelaPrecoProdutoList;
    @OneToMany(mappedBy = "idTabelaMestre")
    private List<TabelaPreco> tabelaPrecoList;
    @JoinColumn(name = "ID_TABELA_MESTRE", referencedColumnName = "ID")
    @ManyToOne
    private TabelaPreco idTabelaMestre;
    @JoinColumn(name = "ID_MOEDA", referencedColumnName = "ID", nullable = false)
    @ManyToOne(optional = false)
    private Moeda idMoeda;

    public TabelaPreco() {
    }

    public TabelaPreco(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public BigDecimal getCoeficiente() {
        return coeficiente;
    }

    public void setCoeficiente(BigDecimal coeficiente) {
        this.coeficiente = coeficiente;
    }

    public Character getPrincipal() {
        return principal;
    }

    public void setPrincipal(Character principal) {
        this.principal = principal;
    }

    public Character getBaseCusto() {
        return baseCusto;
    }

    public void setBaseCusto(Character baseCusto) {
        this.baseCusto = baseCusto;
    }

    @XmlTransient
    public List<TabelaPrecoProduto> getTabelaPrecoProdutoList() {
        return tabelaPrecoProdutoList;
    }

    public void setTabelaPrecoProdutoList(List<TabelaPrecoProduto> tabelaPrecoProdutoList) {
        this.tabelaPrecoProdutoList = tabelaPrecoProdutoList;
    }

    @XmlTransient
    public List<TabelaPreco> getTabelaPrecoList() {
        return tabelaPrecoList;
    }

    public void setTabelaPrecoList(List<TabelaPreco> tabelaPrecoList) {
        this.tabelaPrecoList = tabelaPrecoList;
    }

    public TabelaPreco getIdTabelaMestre() {
        return idTabelaMestre;
    }

    public void setIdTabelaMestre(TabelaPreco idTabelaMestre) {
        this.idTabelaMestre = idTabelaMestre;
    }

    public Moeda getIdMoeda() {
        return idMoeda;
    }

    public void setIdMoeda(Moeda idMoeda) {
        this.idMoeda = idMoeda;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TabelaPreco)) {
            return false;
        }
        TabelaPreco other = (TabelaPreco) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.bs.Beans.TabelaPreco[ id=" + id + " ]";
    }
    
}
